﻿using FPSO.Models.Constant;
using System;
using SqlSugar;
using System.Collections.Generic;

namespace FPSO.Models.Domain
{
    [SugarTable("t_task")]
    public class TankTask
    {
        public TankTask()
        {
            TaskId = 0;
            TaskQueueId = 0;
            TaskName = string.Empty;
            TaskType = 0;
            TankId = "";
			InitVolm = 0;
			TargetVolm = 0;
            PipeSpeed = 0;
            TaskState = TaskStateConstant.DEFAULT_ID;
            TaskResult = TaskResultConstant.DEFAULT_ID;
            StartType = TaskStartTypeConstant.DEFAULT_ID;
            PreTaskId = 0;
            PlanStartTime = DateTime.MinValue;
            PlanEndTime = DateTime.MinValue;
            ExecStartTime = DateTime.MinValue;
            ExecEndTime = DateTime.MinValue;
            SwapTargetTank1 = "";
            WBTTaskList = new List<WBTTask>();
            WBTDetail = string.Empty;
            CreateTime = DateTime.MinValue;
            UpdateTime = DateTime.MinValue;
            DeleteTime = DateTime.MinValue;
        }

        /// <summary>
        /// 任务ID
        /// </summary>
        [SugarColumn(ColumnName = "task_id", IsPrimaryKey = true, IsIdentity = true)]
        public int TaskId { get; set; }
        /// <summary>
        /// 任务队列ID
        /// </summary>
        [SugarColumn(ColumnName = "task_queue")]
        public int TaskQueueId { get; set; }
        /// <summary>
        /// 任务名称
        /// </summary>
        [SugarColumn(ColumnName = "task_name")]
        public string TaskName { get; set; }
        /// <summary>
        /// 任务类型 装载，外输，倒舱
        /// </summary>
        [SugarColumn(ColumnName = "task_type")]
        public int TaskType { get; set; }
        /// <summary>
        /// 舱室ID
        /// </summary>
        [SugarColumn(ColumnName = "tank_id")]
        public string TankId { get; set; }
		/// <summary>
		/// 初始容量百分比
		/// </summary>
		[SugarColumn(ColumnName = "init_volm")]
		public double InitVolm { get; set; }
		/// <summary>
		/// 目标容量百分比
		/// </summary>
		[SugarColumn(ColumnName = "target_volm")]
        public double TargetVolm { get; set; }
        /// <summary>
        /// 管道流速(单位:m³/h)
        /// </summary>
        [SugarColumn(ColumnName = "pipe_speed")]
        public double PipeSpeed { get; set; }
        /// <summary>
        /// 任务状态  正常,正在执行,执行完成,删除(只有正常也就是没执行的任务能够删除)
        /// </summary>
        [SugarColumn(ColumnName = "task_state")]
        public int TaskState { get; set; }
        /// <summary>
        /// 执行结果  未执行,成功，失败
        /// </summary>
        [SugarColumn(ColumnName = "task_result")]
        public int TaskResult { get; set; }
        /// <summary>
        /// 开始类型  定时，指定任务完成时开始
        /// </summary>
        [SugarColumn(ColumnName = "start_type")]
        public int StartType { get; set; }
        /// <summary>
        /// 关联的任务ID
        /// </summary>
        [SugarColumn(ColumnName = "pre_task_id")]
        public int PreTaskId { get; set; }
        /// <summary>
        /// 计划开始时间
        /// </summary>
        [SugarColumn(ColumnName = "plan_start_time")]
        public DateTime PlanStartTime { get; set; }
        /// <summary>
        /// 计划结束时间
        /// </summary>
        [SugarColumn(ColumnName = "plan_end_time")]
        public DateTime PlanEndTime { get; set; }
        /// <summary>
        /// 实际开始时间
        /// </summary>
        [SugarColumn(ColumnName = "exec_start_time")]
        public DateTime ExecStartTime { get; set; }
        /// <summary>
        /// 实际结束时间
        /// </summary>
        [SugarColumn(ColumnName = "exec_end_time")]
        public DateTime ExecEndTime { get; set; }
        /// <summary>
        /// 倒仓目标舱室1（没有时填0）
        /// </summary>
        [SugarColumn(ColumnName = "swap_target_tank1")]
        public string SwapTargetTank1 { get; set; }
        ///// <summary>
        ///// 是否创建对应的压载舱操作(不创建填0)
        ///// </summary>
        //[SugarColumn(ColumnName ="wbt_tank_id")]
        //public int WBTTankId { get; set; }

        /// <summary>
        /// 压载舱任务
        /// </summary>
        [SugarColumn(ColumnName ="wbt_detail")]
        public string WBTDetail { get; set; }

        [SugarColumn(IsIgnore = true)]
        public List<WBTTask> WBTTaskList { get; set; }

        /// <summary>
        /// 任务创建时间
        /// </summary>
        [SugarColumn(ColumnName = "create_time")]
        public DateTime CreateTime { get; set; }
        /// <summary>
        /// 任务修改时间
        /// </summary>
        [SugarColumn(ColumnName = "update_time")]
        public DateTime UpdateTime { get; set; }
        /// <summary>
        /// 任务删除时间
        /// </summary>
        [SugarColumn(ColumnName = "delete_time")]
        public DateTime DeleteTime { get; set; }

        /// <summary>
        /// 验证任务是否正常
        /// </summary>
        /// <returns></returns>
        public bool Validate()
        {

            return true;
        }
    }
}
